package org.dromara.chicken.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.web.core.BaseController;
import org.dromara.chicken.service.IChickenFeedOutInfoService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 鸡饲料投放
 *
 * @author Mr Lei
 * @date 2024-05-29
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/farm/chickenFeedOutInfo")
public class ChickenFeedOutInfoController extends BaseController {

    private final IChickenFeedOutInfoService chickenFeedOutInfoService;

    /**
     * 删除鸡饲料投放
     *
     * @param ids 主键串
     */
    @SaCheckPermission("chicken:chickenFeedOutInfo:remove")
    @Log(title = "鸡饲料投放", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R<Void> remove(@NotNull(message = "主键不能为空")
                          @PathVariable Long[] ids) {
        return toAjax(chickenFeedOutInfoService.deleteWithValidByIds(List.of(ids), true));
    }
}
